// 2025/8/14
// 过桥

#include <iostream>
#include <vector>
using namespace std;

int main() {
    int n; cin >> n;
    vector<int> nums(n);
    for(auto& num : nums)
        cin >> num;
    
    int ans = 0, cur = 0;
    while(cur != n - 1)
    {
        int next = cur;
        for(int i = cur + 1; i <= cur + nums[cur]; i++)
        {
            if(i == n - 1)
            {
                next = i;
                break;
            }
            if(i + nums[i] > next + nums[next])
                next = i;
        }
        if(next == cur)
            break;
        cur = next;
        ans++;
    }
    if(cur == n - 1)
        cout << ans << endl;
    else
        cout << -1 << endl;
    
}
// 64 位输出请用 printf("%lld")